#ifndef EXCEPTIONS_H
#define EXCEPTIONS_H

#include <exception>
#include <qstring.h>
#include <qpoint.h>

class EX_FILE_NOT_FOUND : public std::exception
{
    //Used when referring to an inexistant file
    //Contains the path of that file
private:
    QString m_filePath;
public:
    EX_FILE_NOT_FOUND(const QString& filePath) : m_filePath(filePath) {}
    virtual ~EX_FILE_NOT_FOUND() throw() {}
    virtual const char* what() const throw() {return "ERR : File not found";}
};

class EX_OUT_OF_RANGE : public std::exception
{
    //Used when an array index is out of bounds
    //Contains that index and the bound of valid indexes
private:
    quint16 m_bound;
    quint32 m_tried;
public:
    EX_OUT_OF_RANGE(quint16 bound = 0, quint32 tried = 0) : m_bound(bound), m_tried(tried) {}
    virtual ~EX_OUT_OF_RANGE() throw() {}
    virtual const char* what() const throw() {return "ERR : Out of range";}
};

class EX_FORBIDDEN_MOVE : public std::exception
{
    //Used when an unit executes a move which is not allowed
private:
    QString m_moveType;
    QPoint m_position;
    QPoint m_target;
public:
    EX_FORBIDDEN_MOVE(const QString& moveType, const QPoint& position, const QPoint& target)
        : m_moveType(moveType), m_position(position), m_target(target) {}
    virtual ~EX_FORBIDDEN_MOVE() throw() {}
    virtual const char* what() const throw() {return "ERR : Forbidden move";}
};

#endif // EXCEPTIONS_H
